tools/hv: Fix fortify format warning
authorBen Hutchings <ben@decadent.org.uk>
Fri, 25 Sep 2015 19:28:10 +0000 (20:28 +0100)
committerYves-Alexis Perez <corsac@debian.org>
Fri, 9 Feb 2018 12:58:52 +0000 (12:58 +0000)
commitd3b5315e241b886d130ca9448e21c0ab7c5c7b2b
tree5b349d66a6d8616bd238c9748117125c40b6f629
parent51b3d01a63f37997a15dde67f396eafa527fd9ca
tools/hv: Fix fortify format warning

With fortify enabled, gcc warns:

tools/hv/hv_kvp_daemon.c:705:2: error: format not a string literal and no format arguments [-Werror=format-security]
  snprintf(dev_id, sizeof(dev_id), kvp_net_dir);
  ^

kvp_net_dir is a pointer to a string literal, but lacks const
qualification.  As it is never modified, it should be a const
array rather than a pointer.

Also, while snprintf() has a bounds check, the following strcat()s
do not.  Combine them into a single snprintf().

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/x86
Gbp-Pq: Name tools-hv-fix-fortify-format-warning.patch
tools/hv/hv_kvp_daemon.c